package com.dao;

import com.domain.AssetsFile;
import com.domain.DownloadPassword;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
public interface FileDao {

    @Select("select assetsfile.* from assetsfile where assetsfile.fileName = #{fileName}")
    public AssetsFile findFileName(String fileName);

    @Select("select downloadpassword.* from downloadpassword where downloadpassword.downloadKey = #{downloadKey}")
    public DownloadPassword findDownloadValue(String downloadKey);

    @Insert("insert into downloadpassword (downloadKey, downloadValue) " +
            "values (#{downloadKey}, #{downloadValue})")
    public void addDownloadPassword(DownloadPassword downloadPassword );

    @Update("update downloadpassword set downloadValue = #{value} where downloadKey = #{key}")
    public void updateDownloadPassword(@Param("key") String key, @Param("value") String value);

    @Delete("delete from downloadpassword where downloadKey = #{key}")
    public void delDownloadPassword(String key);
}
